<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Terminology
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot002.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot008.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H1 CLASS="chapter"><A NAME="htoc6">Chapter&nbsp;2</A>&nbsp;&nbsp;Terminology</H1>
<A NAME="terminology"></A>
<A NAME="chapterm"></A>
<BR>
<BR>
This chapter defines the terminology which is used throughout the manual and
in related documentation.
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description"><B>+X</B><A NAME="@default7"></A><DD CLASS="dd-description">
This denotes an input argument. Such an argument must be instantiated before
a built-in is called.<BR>
<BR>
<DT CLASS="dt-description"><B>++X</B><A NAME="@default8"></A><DD CLASS="dd-description">
This denotes a ground argument. Such an argument can be complex,
but must be fully instantiated, i.e., not contain any variables.<BR>
<BR>
<DT CLASS="dt-description"><B>&minus;X</B><A NAME="@default9"></A><DD CLASS="dd-description">
This denotes an output argument. Such an argument must be not
instantiated before a built-in is called.<BR>
<BR>
<DT CLASS="dt-description"><B>?X</B><A NAME="@default10"></A><DD CLASS="dd-description">
This denotes an input or an output argument. Such an argument may be either
instantiated or not when a built-in is called.<BR>
<BR>
<DT CLASS="dt-description"><B>Arity</B><A NAME="@default11"></A><DD CLASS="dd-description">
Arity is the number of arguments to a term.
Atoms are considered as functors with zero arity.
The notation <I><FONT COLOR=maroon>Name/Arity</FONT></I><A NAME="@default12"></A>
is used to specify a functor by giving its name and arity.<BR>
<BR>
<DT CLASS="dt-description"><B>Atom</B><A NAME="@default13"></A><DD CLASS="dd-description">
An arbitrary name chosen by the user to represent objects from the
problem domain.
A Prolog atom corresponds to an identifier in other languages. It can be
written as a conventional identifier (beginning with a lower-case letter), or
a character sequnce enclosed in single quotes.<BR>
<BR>
<DT CLASS="dt-description"><B>Atomic</B><A NAME="@default14"></A><DD CLASS="dd-description">
An atom, string or a number. A term which does not contain other terms.<BR>
<BR>
<DT CLASS="dt-description"><B>Body</B><A NAME="@default15"></A><A NAME="@default16"></A><DD CLASS="dd-description">
A clause body can either be of the form
<PRE CLASS="verbatim">
Goal_1, Goal_2, ..., Goal_k
</PRE>or simply
<PRE CLASS="verbatim">
Goal
</PRE>Each <EM>Goal_i</EM> must be a <EM>callable term</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Built-in Procedures</B><A NAME="@default17"></A><A NAME="@default18"></A><DD CLASS="dd-description">
These are predicates provided for the user by the
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> system, they are either written in Prolog or in the implementation
language (usually C).<BR>
<BR>
<DT CLASS="dt-description"><B>Callable Term</B><A NAME="@default19"></A><A NAME="@default20"></A><DD CLASS="dd-description">
A callable term is either a compound term or an atom.<BR>
<BR>
<DT CLASS="dt-description"><B>Clause</B><A NAME="@default21"></A><DD CLASS="dd-description">
See <EM>program clause</EM> or <EM>goal clause</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Compound Term</B><A NAME="@default22"></A><A NAME="@default23"></A><DD CLASS="dd-description">
Compound terms are of the form
<PRE CLASS="verbatim">
f(t_1, t_2, ..., t_n)
</PRE>where <EM>f</EM> is the <EM>functor</EM><A NAME="@default24"></A> of the compound term, <EM>n</EM> is its
arity and <EM>t_i</EM> are terms.
<EM>Lists</EM> and <EM>pairs</EM> are also compound terms.<BR>
<BR>
<DT CLASS="dt-description"><B>Constant</B><A NAME="@default25"></A><A NAME="@default26"></A><DD CLASS="dd-description">
An <EM>atom</EM>, a <EM>number</EM> or a <EM>string</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Determinism</B><A NAME="@default27"></A><DD CLASS="dd-description">
The determinism specification of a built-in or library predicate says
how many solutions the predicate can have, and whether it can fail.
The six determinism groups are defined as follows:
<PRE CLASS="verbatim">
                |   Maximum number of solutions
    Can fail?   |   0               1               &gt; 1
    ------------+------------------------------------------
    no          |   erroneous       det             multi
    yes         |   failure         semidet         nondet
</PRE>This classification is borrowed from the Mercury programming language,
but in ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> only used for the purpose of documentation.
Note that the determinism of a predicate usually depends on its calling mode.<BR>
<BR>
<DT CLASS="dt-description"><B>DID</B><A NAME="@default28"></A><A NAME="@default29"></A><DD CLASS="dd-description">
Each atom created within ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> is assigned a unique
identifier called the <EM>dictionary identifier</EM> or <EM>DID</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Difference List</B><A NAME="@default30"></A><A NAME="@default31"></A><DD CLASS="dd-description">
A difference list is a special kind of a list.
Instead of being ended by <EM>nil</EM>, a difference list
has an uninstantiated tail so that new elements
can be appended to it in constant time.
A difference list is written as <EM>List - Tail</EM>
where <EM>List</EM> is the beginning of the list and <EM>Tail</EM>
is its uninstantiated tail.
Programs that use difference lists are usually more efficient
and always much less readable than programs without them.<BR>
<BR>
<DT CLASS="dt-description"><B>Dynamic Procedure</B><A NAME="@default32"></A><A NAME="@default33"></A><DD CLASS="dd-description">
These are procedures which can be modified clause-wise, by adding or removing
one clause at a time. Note that this class of procedure is equivalent to
interpreted procedures in other Prolog systems. See also <EM>static
procedures</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>External Procedures</B><A NAME="@default34"></A><A NAME="@default35"></A><DD CLASS="dd-description">
These are procedures which are defined in a language
other than Prolog, and explicitly connected to Prolog predicates by the user.<BR>
<BR>
<DT CLASS="dt-description"><B>Fact</B><A NAME="@default36"></A><DD CLASS="dd-description">
A fact or <EM>unit clause</EM><A NAME="@default37"></A><A NAME="@default38"></A> is a term of the form:
<PRE CLASS="verbatim">
Head.
</PRE>where <TT>Head</TT> is a <EM>head</EM>.<BR>
<BR>
A fact may be considered to be a rule whose body is always <EM>true</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Functor</B><A NAME="@default39"></A><DD CLASS="dd-description">
A functor is characterised by its name (which is an atom), and its arity
(which is its number of arguments).<BR>
<BR>
<DT CLASS="dt-description"><B>Goal Clause</B><A NAME="@default40"></A><A NAME="@default41"></A><DD CLASS="dd-description">
See <EM>query</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Ground</B><A NAME="@default42"></A><A NAME="@default43"></A><DD CLASS="dd-description">
A term is ground when it does not contain any uninstantiated variables.<BR>
<BR>
<DT CLASS="dt-description"><B>Head</B><A NAME="@default44"></A><A NAME="@default45"></A><DD CLASS="dd-description">
A clause head is a structure or an atom.<BR>
<BR>
<DT CLASS="dt-description"><B>Instantiated</B><A NAME="@default46"></A><A NAME="@default47"></A><DD CLASS="dd-description">
A variable is instantiated when it has been bound to an atomic or a
compound term as opposed to being <EM>uninstantiated</EM><A NAME="@default48"></A><A NAME="@default49"></A>
or <EM>free</EM><A NAME="@default50"></A><A NAME="@default51"></A>.
See also <EM>ground</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>List</B><A NAME="@default52"></A><DD CLASS="dd-description">
A list is a special type of term within Prolog. It is a
recursive data structure consisting of <EM>pairs</EM> (whose tails are lists).
A <TT>list</TT> is either the atom <TT>[]</TT><A NAME="@default53"></A> called <TT>nil</TT><A NAME="@default54"></A>
as in LISP,
or a pair whose tail is a list.
The notation :
<PRE CLASS="verbatim">
[a , b , c]
</PRE>is shorthand for:
<PRE CLASS="verbatim">
[a | [b | [c | []]]]
</PRE><BR>
<BR>
<DT CLASS="dt-description"><B>Mode</B><A NAME="@default55"></A><DD CLASS="dd-description">
A predicate mode is a particular instantiation pattern of its arguments
at call time. Such a pattern is usually written as a predicate template, e.g.,
<PRE CLASS="verbatim">
    p(+,-)
</PRE>where the symbols <TT>+</TT>, <TT>++</TT>, <TT>-</TT> and <TT>?</TT>
represent
instantiated, ground, uninstantiated and unknown arguments respectively.<BR>
<BR>
<DT CLASS="dt-description"><B>Name/Arity</B><DD CLASS="dd-description">
The notation <I><FONT COLOR=maroon>Name/Arity</FONT></I><A NAME="@default56"></A> is used to specify a functor by giving its
name and arity.<BR>
<BR>
<DT CLASS="dt-description"><B>Number</B><A NAME="@default57"></A><DD CLASS="dd-description">
A number literal denotes a number, more or less like in all programming
languages.<BR>
<BR>
<DT CLASS="dt-description"><B>Pair</B><A NAME="@default58"></A><DD CLASS="dd-description">
A pair is a compound term with the functor <TT>./2</TT> (<TT>dot</TT>)
which is written as :
<PRE CLASS="verbatim">
[H|T]
</PRE><TT>H</TT> is the <TT>head</TT><A NAME="@default59"></A><A NAME="@default60"></A>
of the pair and <TT>T</TT> its <TT>tail</TT><A NAME="@default61"></A><A NAME="@default62"></A>.<BR>
<BR>
<DT CLASS="dt-description"><B>Predicate</B><A NAME="@default63"></A><DD CLASS="dd-description">
A predicate is another term for a <EM>procedure</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>PredSpec</B><A NAME="@default64"></A><DD CLASS="dd-description">
This is similar to <I><FONT COLOR=maroon>Name/Arity</FONT></I>.
Some built-ins allow the arity to be omitted and to specify the name only:
this stands for all (visible) predicates with that name and any arity.<BR>
<BR>
<DT CLASS="dt-description"><B>Program Clause</B><A NAME="@default65"></A><A NAME="@default66"></A><A NAME="@default67"></A><DD CLASS="dd-description">
A program clause (or simply <EM>clause</EM>) is either the term
<PRE CLASS="verbatim">
Head :- Body.
</PRE><A NAME="@default68"></A>
(i.e., a compound term with the functor <B>:-/2</B>), or only a fact.<BR>
<BR>
<DT CLASS="dt-description"><B>Query</B><A NAME="@default69"></A><DD CLASS="dd-description">
A query has the same form as a <EM>body</EM> and is also called a <EM>goal</EM>.
Such clauses occur mainly as input to the top level Prolog loop
and in files being compiled, then they have the form
<PRE CLASS="verbatim">
:- Goal_1, ..., Goal_k.
</PRE>or
<PRE CLASS="verbatim">
?- Goal_1, ..., Goal_k.
</PRE>The first of these two forms is often called a <EM>directive</EM><A NAME="@default70"></A>.<BR>
<BR>
<DT CLASS="dt-description"><B>Regular Prolog Procedure</B><A NAME="@default71"></A><A NAME="@default72"></A><DD CLASS="dd-description"><BR>
<BR>
A regular (Prolog) procedure is a sequence of user clauses whose heads
have the same functor, which then identifies the user procedure.<BR>
<BR>
<DT CLASS="dt-description"><B>Simple Procedures</B><A NAME="@default73"></A><A NAME="@default74"></A><DD CLASS="dd-description">
Apart from regular procedures ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> recognises simple procedures
which are written not in Prolog but in the implementation language (i.e., C),
and which are deterministic.
There is a functor associated with each
simple procedure, so that
any procedure recognisable by ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> is identified by a functor,
<A NAME="@default75"></A><A NAME="@default76"></A>
or by a compound term (or atom) with this functor.<BR>
<BR>
<DT CLASS="dt-description"><B>SpecList</B><A NAME="@default77"></A><DD CLASS="dd-description">
The SpecList notation means a sequence of <EM>PredSpec</EM> terms of the form:
<PRE CLASS="verbatim">
name_1/arity_1, name_2/arity_2, ..., name_k/arity_k.
</PRE>The SpecList notation is used in many built-ins, for example,
to specify a list of procedures in the
<A HREF="../bips/kernel/modules/export-1.html"><B>export/1</B></A><A NAME="@default78"></A> predicate.<BR>
<BR>
<DT CLASS="dt-description"><B>Static Procedures</B><A NAME="@default79"></A><A NAME="@default80"></A><DD CLASS="dd-description">
These are procedures which can only be changed as a whole unit, i.e., removed or
replaced.<BR>
<BR>
<DT CLASS="dt-description"><B>Stream</B><A NAME="@default81"></A><DD CLASS="dd-description">
This is an I/O channel identifier and can be a physical stream number, one of
the predefined stream identifiers (<TT>input</TT>, <TT>output</TT>,
<TT>error</TT>, <TT>warning_output</TT>, <TT>log_output</TT>,
<TT>null</TT>)
or a user defined stream name (defined using
<A HREF="../bips/kernel/iostream/set_stream-2.html"><B>set_stream/2</B></A><A NAME="@default82"></A> or
 <A HREF="../bips/kernel/iostream/open-3.html"><B>open/3</B></A><A NAME="@default83"></A>).<BR>
<BR>
<DT CLASS="dt-description"><B>String</B><A NAME="@default84"></A><DD CLASS="dd-description">
A string is similar to those found in all other programming languages. A string
is enclosed in double quotes.<BR>
<BR>
<DT CLASS="dt-description"><B>Structure</B><A NAME="@default85"></A><DD CLASS="dd-description">
Compound terms which are not pairs are also called <EM>structures</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Term</B><A NAME="@default86"></A><DD CLASS="dd-description">
A term is the basic data type in Prolog.
It is either a <EM>variable</EM>, a <EM>constant</EM> or a <EM>compound term</EM>.<BR>
<BR>
<DT CLASS="dt-description"><B>Variable</B><A NAME="@default87"></A><A NAME="@default88"></A><DD CLASS="dd-description">
A variable is more similar to a mathematical variable than to a variable in some
imperative language. It can be free, or instantiated to a term, but once
instantiated it becomes indistinguishable from the term to which it was
instantiated: in particular, it cannot become free again (except upon
backtracking through the point of instantiation).
The name of a variable is written in the form of an identifier that begins with
an upper-case letter or with an underscore. A single underscore represents an
<EM>anonymous variable</EM><A NAME="@default89"></A><A NAME="@default90"></A> that has only one
occurrence (i.e., another occurrence of this name represents another variable).</DL>
The notation <I><FONT COLOR=maroon>Pred/N1, N2</FONT></I> is often used in this documentation
as a shorthand for <I><FONT COLOR=maroon>Pred/N1, Pred/N2</FONT></I>.<BR>
<BR>

<BR>
<BR>




<BR>
<BR>
<HR>
<A HREF="umsroot002.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot008.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
